﻿namespace DimensionsHelper.CommandLine.ConsoleTracer;

public interface INavigatorLine
{
    /// <summary>
    ///     获取当前行区间
    /// </summary>
    ConsoleLocation GetLocation();


    /// <summary>
    ///     获取行的第一个区间
    /// </summary>
    /// <returns></returns>
    INavigatorRange? First();


    /// <summary>
    ///     获取行的最后一个区间
    /// </summary>
    /// <returns></returns>
    INavigatorRange? Last();


    /// <summary>
    ///     获取指定索引的区间
    /// </summary>
    INavigatorRange? RangeAt(int index);


    /// <summary>
    ///     获取前一行
    /// </summary>
    INavigatorLine? PreviousLine();


    /// <summary>
    ///     获取后一行
    /// </summary>
    INavigatorLine? NextLine();


    /// <summary>
    ///     向末尾追加一个新的区间
    /// </summary>
    /// <param name="content">追加的文本内容</param>
    /// <returns>新添加的区间</returns>
    INavigatorRange Append(string content);


    /// <summary>
    ///     将当前行进行向上或向下的偏移
    /// </summary>
    /// <param name="shiftLines">偏移的行数</param>
    void Shift(int shiftLines);


    /// <summary>
    ///     刷新行区间显示内容
    /// </summary>
    void Refresh();


    /// <summary>
    ///     清空行区间显示内容
    /// </summary>
    void Clear();
}